// JavaScript Document
$(function(){
    $('.Calc').click(function(){
	    var height = $('#height').val();
	    var weight = $('#weight').val();
	    if(height==""||height==null){
		    alert('身高不能为空'); 
	    }else if(!(/^\d{1,3}$/.test(height))){
		    alert('请填写正确的身高');
	    }else if(weight==""||weight==null){
		    alert('体重不能为空'); 
	    }else if(!(/^\d{1,3}$/.test(weight))){
		    alert('请填写正确的体重');  
	    }else{
		    var tempHeight=height / 100;
		    var temp = tempHeight * tempHeight;
			    temp = (weight / temp).toFixed(1);
			    $('#BMI em').text(temp);	
	    }
    });
});
